Dynomotion

Group: DynoMotion Message: 5621 From: stephen_lamarr Date: 8/29/2012
Subject: KMotion Help
I am getting a 1.#QNAN on my destination reading on my axis. Using stepper motors. I was told to post here for a resolution. I checked all of my accels; decels, velocity's, ect. all looks good. Not sure where to go from here. Any info would help.
Group: DynoMotion Message: 5623 From: Tom Kerekes Date: 8/29/2012
Subject: Re: KMotion Help
Hi Stephen,
 
That would indicate some sort of invalid motion command or motion parameter.  Please provide more information on how things are configured and what steps you are doing to cause this.
 
Are you seeing this on the Axis Screen?  Cycle power on KFLOP to set everything to the default configuration.  Then observe that the Axis Screen shows 0 for the Destination.  Then observe what step causes it to become invalid.
 
Regards
TK

Group: DynoMotion Message: 5624 From: stephen_lamarr Date: 8/29/2012
Subject: Re: KMotion Help
When I open up the axis screen all read 0. The NAN shows when I try to move the axis via my machine manager program. You may now of Machine Manager. Designed by Brad Murry. When machine manager is started up, the program loads the motion parameters. I am able to clear the destination out to 0 by disabeling and enabeling the motor. When I try and run the Home C program it fails on the first of six axis and gives me the NAN on the destination.

This is the home c program.

#include "KMotionDef.h"

// Homing program for a 3 axis System
// Limit switches are disabled and used as a home switch
// then they are re-enabled

#define XHOME 168
#define YHOME 169
#define ZHOME 170
void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset);

main()
{

DoHome( 0, // axis Laser #4
100, // speed steps/sec
1, // direction to home
171, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)

DoHome( 1, // Laser #3
100, // speed steps/sec
-1, // direction to home
170, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)

DoHome( 2, // Laser #2
100, // speed steps/sec
-1, // direction to home
169, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)

DoHome( 3, // Laser #1
100, // speed steps/sec
1, // direction to home
168, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)

DoHome( 4, // Laser #6
100, // speed steps/sec
-1, // direction to home
173, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)

DoHome( 5, // Laser #5
100, // speed steps/sec
1, // direction to home
172, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)


}
void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset)
{
float oppdir = dir * -1;

EnableAxis(axis);
if(ReadBit(bit)==polarity)
{
Jog(axis, speed * oppdir); // start moving
while (ReadBit(bit) == polarity) ; // wait for switch (input #8) to change
Jog(axis,0); // stop
MoveRelAtVel(axis,sensoroffset * oppdir,speed);
}
Jog(axis, speed * dir); // start moving
while (ReadBit(bit) != polarity) ; // wait for switch (input #8) to change
Jog(axis,0); // stop
while (!CheckDone(axis)) ;
MoveRelAtVel(axis,sensoroffset * oppdir,speed);
while (!CheckDone(axis)) ;
EnableAxisDest(axis,0);
}


This is the c program that loads the paramaters on startup.

#include "KMotionDef.h"

// Defines axis 0, 1, 2 as simple step dir TTL outputs for KSTEP
// enables them
// sets them as an xyz coordinate system for GCode

int main()
{
double T0, LastX=0, LastY=0, LastZ=0, Tau;

KStepPresent=TRUE; // enable KSTEP input multiplexing
//FPGA(STEP_PULSE_LENGTH_ADD) = 0x80 + 32; // set inverted and to 2us
FPGA(STEP_PULSE_LENGTH_ADD) = 0x80 + 63;
ch0->InputMode=NO_INPUT_MODE;
ch0->OutputMode=STEP_DIR_MODE;
ch0->Vel=80000;
ch0->Accel=80000;
ch0->Jerk=4e+006;
ch0->P=0;
ch0->I=0.01;
ch0->D=0;
ch0->FFAccel=0;
ch0->FFVel=0;
ch0->MaxI=200;
ch0->MaxErr=1e+006;
ch0->MaxOutput=200;
ch0->DeadBandGain=1;
ch0->DeadBandRange=0;
ch0->InputChan0=0;
ch0->InputChan1=0;
ch0->OutputChan0=8;
ch0->OutputChan1=0;
ch0->MasterAxis=-1;
ch0->LimitSwitchOptions=0x0;
ch0->InputGain0=1;
ch0->InputGain1=1;
ch0->InputOffset0=0;
ch0->InputOffset1=0;
ch0->OutputGain=1;
ch0->OutputOffset=0;
ch0->SlaveGain=1;
ch0->BacklashMode=BACKLASH_OFF;
ch0->BacklashAmount=0;
ch0->BacklashRate=0;
ch0->invDistPerCycle=1;
ch0->Lead=0;
ch0->MaxFollowingError=1000000000;
ch0->StepperAmplitude=20;

ch0->iir[0].B0=1;
ch0->iir[0].B1=0;
ch0->iir[0].B2=0;
ch0->iir[0].A1=0;
ch0->iir[0].A2=0;

ch0->iir[1].B0=1;
ch0->iir[1].B1=0;
ch0->iir[1].B2=0;
ch0->iir[1].A1=0;
ch0->iir[1].A2=0;

ch0->iir[2].B0=0.000769;
ch0->iir[2].B1=0.001538;
ch0->iir[2].B2=0.000769;
ch0->iir[2].A1=1.92076;
ch0->iir[2].A2=-0.923833;
EnableAxisDest(0,0);

ch1->InputMode=NO_INPUT_MODE;
ch1->OutputMode=STEP_DIR_MODE;
ch1->Vel=80000;
ch1->Accel=80000;
ch1->Jerk=4e+006;
ch1->P=0;
ch1->I=0.01;
ch1->D=0;
ch1->FFAccel=0;
ch1->FFVel=0;
ch1->MaxI=200;
ch1->MaxErr=1e+006;
ch1->MaxOutput=200;
ch1->DeadBandGain=1;
ch1->DeadBandRange=0;
ch1->InputChan0=0;
ch1->InputChan1=0;
ch1->OutputChan0=13;//9;
ch1->OutputChan1=0;
ch1->MasterAxis=-1;
ch1->LimitSwitchOptions=0x0;
ch1->InputGain0=1;
ch1->InputGain1=1;
ch1->InputOffset0=0;
ch1->InputOffset1=0;
ch1->OutputGain=1;
ch1->OutputOffset=0;
ch1->SlaveGain=1;
ch1->BacklashMode=BACKLASH_OFF;
ch1->BacklashAmount=0;
ch1->BacklashRate=0;
ch1->invDistPerCycle=1;
ch1->Lead=0;
ch1->MaxFollowingError=1000000000;
ch1->StepperAmplitude=20;

ch1->iir[0].B0=1;
ch1->iir[0].B1=0;
ch1->iir[0].B2=0;
ch1->iir[0].A1=0;
ch1->iir[0].A2=0;

ch1->iir[1].B0=1;
ch1->iir[1].B1=0;
ch1->iir[1].B2=0;
ch1->iir[1].A1=0;
ch1->iir[1].A2=0;

ch1->iir[2].B0=1;
ch1->iir[2].B1=0;
ch1->iir[2].B2=0;
ch1->iir[2].A1=0;
ch1->iir[2].A2=0;
EnableAxisDest(1,0);

ch2->InputMode=NO_INPUT_MODE;
ch2->OutputMode=STEP_DIR_MODE;
ch2->Vel=80000;
ch2->Accel=80000;
ch2->Jerk=4e+006;
ch2->P=0;
ch2->I=0.01;
ch2->D=0;
ch2->FFAccel=0;
ch2->FFVel=0;
ch2->MaxI=200;
ch2->MaxErr=1e+006;
ch2->MaxOutput=200;
ch2->DeadBandGain=1;
ch2->DeadBandRange=0;
ch2->InputChan0=0;
ch2->InputChan1=0;
ch2->OutputChan0=10;
ch2->OutputChan1=0;
ch2->MasterAxis=-1;
ch2->LimitSwitchOptions=0x0;
ch2->InputGain0=1;
ch2->InputGain1=1;
ch2->InputOffset0=0;
ch2->InputOffset1=0;
ch2->OutputGain=-1;
ch2->OutputOffset=0;
ch2->SlaveGain=1;
ch2->BacklashMode=BACKLASH_OFF;
ch2->BacklashAmount=0;
ch2->BacklashRate=0;
ch2->invDistPerCycle=1;
ch2->Lead=0;
ch2->MaxFollowingError=1000000000;
ch2->StepperAmplitude=20;

ch2->iir[0].B0=1;
ch2->iir[0].B1=0;
ch2->iir[0].B2=0;
ch2->iir[0].A1=0;
ch2->iir[0].A2=0;

ch2->iir[1].B0=1;
ch2->iir[1].B1=0;
ch2->iir[1].B2=0;
ch2->iir[1].A1=0;
ch2->iir[1].A2=0;

ch2->iir[2].B0=1;
ch2->iir[2].B1=0;
ch2->iir[2].B2=0;
ch2->iir[2].A1=0;
ch2->iir[2].A2=0;
EnableAxisDest(2,0);


ch3->InputMode=NO_INPUT_MODE;
ch3->OutputMode=STEP_DIR_MODE;
ch3->Vel=80000;
ch3->Accel=80000;
ch3->Jerk=4e+006;
ch3->P=0;
ch3->I=0.01;
ch3->D=0;
ch3->FFAccel=0;
ch3->FFVel=0;
ch3->MaxI=200;
ch3->MaxErr=1e+006;
ch3->MaxOutput=200;
ch3->DeadBandGain=1;
ch3->DeadBandRange=0;
ch3->InputChan0=0;
ch3->InputChan1=0;
ch3->OutputChan0=11;
ch3->OutputChan1=0;
ch3->MasterAxis=-1;
ch3->LimitSwitchOptions=0x0;
ch3->InputGain0=1;
ch3->InputGain1=1;
ch3->InputOffset0=0;
ch3->InputOffset1=0;
ch3->OutputGain=-1;
ch3->OutputOffset=0;
ch3->SlaveGain=1;
ch3->BacklashMode=BACKLASH_OFF;
ch3->BacklashAmount=0;
ch3->BacklashRate=0;
ch3->invDistPerCycle=1;
ch3->Lead=0;
ch3->MaxFollowingError=1000000000;
ch3->StepperAmplitude=20;

ch3->iir[0].B0=1;
ch3->iir[0].B1=0;
ch3->iir[0].B2=0;
ch3->iir[0].A1=0;
ch3->iir[0].A2=0;

ch3->iir[1].B0=1;
ch3->iir[1].B1=0;
ch3->iir[1].B2=0;
ch3->iir[1].A1=0;
ch3->iir[1].A2=0;

ch3->iir[2].B0=1;
ch3->iir[2].B1=0;
ch3->iir[2].B2=0;
ch3->iir[2].A1=0;
ch3->iir[2].A2=0;
EnableAxisDest(3,0);



ch4->InputMode=NO_INPUT_MODE;
ch4->OutputMode=STEP_DIR_MODE;
ch4->Vel=80000;
ch4->Accel=80000;
ch4->Jerk=4e+006;
ch4->P=0;
ch4->I=0.01;
ch4->D=0;
ch4->FFAccel=0;
ch4->FFVel=0;
ch4->MaxI=200;
ch4->MaxErr=1e+006;
ch4->MaxOutput=200;
ch4->DeadBandGain=1;
ch4->DeadBandRange=0;
ch4->InputChan0=0;
ch4->InputChan1=0;
ch4->OutputChan0=14;
ch4->OutputChan1=0;
ch4->MasterAxis=-1;
ch4->LimitSwitchOptions=0x0;
ch4->InputGain0=1;
ch4->InputGain1=1;
ch4->InputOffset0=0;
ch4->InputOffset1=0;
ch4->OutputGain=-1;
ch4->OutputOffset=0;
ch4->SlaveGain=1;
ch4->BacklashMode=BACKLASH_OFF;
ch4->BacklashAmount=0;
ch4->BacklashRate=0;
ch4->invDistPerCycle=1;
ch4->Lead=0;
ch4->MaxFollowingError=1000000000;
ch4->StepperAmplitude=20;

ch4->iir[0].B0=1;
ch4->iir[0].B1=0;
ch4->iir[0].B2=0;
ch4->iir[0].A1=0;
ch4->iir[0].A2=0;

ch4->iir[1].B0=1;
ch4->iir[1].B1=0;
ch4->iir[1].B2=0;
ch4->iir[1].A1=0;
ch4->iir[1].A2=0;

ch4->iir[2].B0=1;
ch4->iir[2].B1=0;
ch4->iir[2].B2=0;
ch4->iir[2].A1=0;
ch4->iir[2].A2=0;
EnableAxisDest(4,0);



ch5->InputMode=NO_INPUT_MODE;
ch5->OutputMode=STEP_DIR_MODE;
ch5->Vel=80000;
ch5->Accel=80000;
ch5->Jerk=4e+006;
ch5->P=0;
ch5->I=0.01;
ch5->D=0;
ch5->FFAccel=0;
ch5->FFVel=0;
ch5->MaxI=200;
ch5->MaxErr=1e+006;
ch5->MaxOutput=200;
ch5->DeadBandGain=1;
ch5->DeadBandRange=0;
ch5->InputChan0=0;
ch5->InputChan1=0;
ch5->OutputChan0=15;
ch5->OutputChan1=0;
ch5->MasterAxis=-1;
ch5->LimitSwitchOptions=0x0;
ch5->InputGain0=1;
ch5->InputGain1=1;
ch5->InputOffset0=0;
ch5->InputOffset1=0;
ch5->OutputGain=-1;
ch5->OutputOffset=0;
ch5->SlaveGain=1;
ch5->BacklashMode=BACKLASH_OFF;
ch5->BacklashAmount=0;
ch5->BacklashRate=0;
ch5->invDistPerCycle=1;
ch5->Lead=0;
ch5->MaxFollowingError=1000000000;
ch5->StepperAmplitude=20;

ch5->iir[0].B0=1;
ch5->iir[0].B1=0;
ch5->iir[0].B2=0;
ch5->iir[0].A1=0;
ch5->iir[0].A2=0;

ch5->iir[1].B0=1;
ch5->iir[1].B1=0;
ch5->iir[1].B2=0;
ch5->iir[1].A1=0;
ch5->iir[1].A2=0;

ch5->iir[2].B0=1;
ch5->iir[2].B1=0;
ch5->iir[2].B2=0;
ch5->iir[2].A1=0;
ch5->iir[2].A2=0;
EnableAxisDest(5,0);


DefineCoordSystem6(0,1,2,3,4,5);

SetBitDirection(45,1); // set Enable Signal as Output
SetBit(45); // Enable the amplifiers



return 0;
}


--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Stephen,
>  
> That would indicate some sort of invalid motion command or motion parameter.  Please provide more information on how things are configured and what steps you are doing to cause this.
>  
> Are you seeing this on the Axis Screen?  Cycle power on KFLOP to set everything to the default configuration.  Then observe that the Axis Screen shows 0 for the Destination.  Then observe what step causes it to become invalid.
>  
> Regards
> TK
>
> From: stephen_lamarr <stephen_lamarr@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, August 29, 2012 12:25 PM
> Subject: [DynoMotion] KMotion Help
>
>
>  
> I am getting a 1.#QNAN on my destination reading on my axis. Using stepper motors. I was told to post here for a resolution. I checked all of my accels; decels, velocity's, ect. all looks good. Not sure where to go from here. Any info would help.
>
Group: DynoMotion Message: 5625 From: Lee Studley Date: 8/29/2012
Subject: Re: KMotion Help
Tau not defined:

int main()
{
double T0, LastX=0, LastY=0, LastZ=0, Tau;





On 8/29/2012 12:59 PM, stephen_lamarr wrote:
> When I open up the axis screen all read 0. The NAN shows when I try to move the axis via my machine manager program. You may now of Machine Manager. Designed by Brad Murry. When machine manager is started up, the program loads the motion parameters. I am able to clear the destination out to 0 by disabeling and enabeling the motor. When I try and run the Home C program it fails on the first of six axis and gives me the NAN on the destination.
>
> This is the home c program.
>
> #include "KMotionDef.h"
>
> // Homing program for a 3 axis System
> // Limit switches are disabled and used as a home switch
> // then they are re-enabled
>
> #define XHOME 168
> #define YHOME 169
> #define ZHOME 170
> void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset);
>
> main()
> {
>
> DoHome( 0, // axis Laser #4
> 100, // speed steps/sec
> 1, // direction to home
> 171, // home input bit
> 1, // bit polarity (0 or 1) when tripped
> 10); // amount to move back inside (counts)
>
> DoHome( 1, // Laser #3
> 100, // speed steps/sec
> -1, // direction to home
> 170, // home input bit
> 1, // bit polarity (0 or 1) when tripped
> 10); // amount to move back inside (counts)
>
> DoHome( 2, // Laser #2
> 100, // speed steps/sec
> -1, // direction to home
> 169, // home input bit
> 1, // bit polarity (0 or 1) when tripped
> 10); // amount to move back inside (counts)
>
> DoHome( 3, // Laser #1
> 100, // speed steps/sec
> 1, // direction to home
> 168, // home input bit
> 1, // bit polarity (0 or 1) when tripped
> 10); // amount to move back inside (counts)
>
> DoHome( 4, // Laser #6
> 100, // speed steps/sec
> -1, // direction to home
> 173, // home input bit
> 1, // bit polarity (0 or 1) when tripped
> 10); // amount to move back inside (counts)
>
> DoHome( 5, // Laser #5
> 100, // speed steps/sec
> 1, // direction to home
> 172, // home input bit
> 1, // bit polarity (0 or 1) when tripped
> 10); // amount to move back inside (counts)
>
>
> }
> void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset)
> {
> float oppdir = dir * -1;
>
> EnableAxis(axis);
> if(ReadBit(bit)==polarity)
> {
> Jog(axis, speed * oppdir); // start moving
> while (ReadBit(bit) == polarity) ; // wait for switch (input #8) to change
> Jog(axis,0); // stop
> MoveRelAtVel(axis,sensoroffset * oppdir,speed);
> }
> Jog(axis, speed * dir); // start moving
> while (ReadBit(bit) != polarity) ; // wait for switch (input #8) to change
> Jog(axis,0); // stop
> while (!CheckDone(axis)) ;
> MoveRelAtVel(axis,sensoroffset * oppdir,speed);
> while (!CheckDone(axis)) ;
> EnableAxisDest(axis,0);
> }
>
>
> This is the c program that loads the paramaters on startup.
>
> #include "KMotionDef.h"
>
> // Defines axis 0, 1, 2 as simple step dir TTL outputs for KSTEP
> // enables them
> // sets them as an xyz coordinate system for GCode
>
> int main()
> {
> double T0, LastX=0, LastY=0, LastZ=0, Tau;
>
> KStepPresent=TRUE; // enable KSTEP input multiplexing
> //FPGA(STEP_PULSE_LENGTH_ADD) = 0x80 + 32; // set inverted and to 2us
> FPGA(STEP_PULSE_LENGTH_ADD) = 0x80 + 63;
> ch0->InputMode=NO_INPUT_MODE;
> ch0->OutputMode=STEP_DIR_MODE;
> ch0->Vel=80000;
> ch0->Accel=80000;
> ch0->Jerk=4e+006;
> ch0->P=0;
> ch0->I=0.01;
> ch0->D=0;
> ch0->FFAccel=0;
> ch0->FFVel=0;
> ch0->MaxI=200;
> ch0->MaxErr=1e+006;
> ch0->MaxOutput=200;
> ch0->DeadBandGain=1;
> ch0->DeadBandRange=0;
> ch0->InputChan0=0;
> ch0->InputChan1=0;
> ch0->OutputChan0=8;
> ch0->OutputChan1=0;
> ch0->MasterAxis=-1;
> ch0->LimitSwitchOptions=0x0;
> ch0->InputGain0=1;
> ch0->InputGain1=1;
> ch0->InputOffset0=0;
> ch0->InputOffset1=0;
> ch0->OutputGain=1;
> ch0->OutputOffset=0;
> ch0->SlaveGain=1;
> ch0->BacklashMode=BACKLASH_OFF;
> ch0->BacklashAmount=0;
> ch0->BacklashRate=0;
> ch0->invDistPerCycle=1;
> ch0->Lead=0;
> ch0->MaxFollowingError=1000000000;
> ch0->StepperAmplitude=20;
>
> ch0->iir[0].B0=1;
> ch0->iir[0].B1=0;
> ch0->iir[0].B2=0;
> ch0->iir[0].A1=0;
> ch0->iir[0].A2=0;
>
> ch0->iir[1].B0=1;
> ch0->iir[1].B1=0;
> ch0->iir[1].B2=0;
> ch0->iir[1].A1=0;
> ch0->iir[1].A2=0;
>
> ch0->iir[2].B0=0.000769;
> ch0->iir[2].B1=0.001538;
> ch0->iir[2].B2=0.000769;
> ch0->iir[2].A1=1.92076;
> ch0->iir[2].A2=-0.923833;
> EnableAxisDest(0,0);
>
> ch1->InputMode=NO_INPUT_MODE;
> ch1->OutputMode=STEP_DIR_MODE;
> ch1->Vel=80000;
> ch1->Accel=80000;
> ch1->Jerk=4e+006;
> ch1->P=0;
> ch1->I=0.01;
> ch1->D=0;
> ch1->FFAccel=0;
> ch1->FFVel=0;
> ch1->MaxI=200;
> ch1->MaxErr=1e+006;
> ch1->MaxOutput=200;
> ch1->DeadBandGain=1;
> ch1->DeadBandRange=0;
> ch1->InputChan0=0;
> ch1->InputChan1=0;
> ch1->OutputChan0=13;//9;
> ch1->OutputChan1=0;
> ch1->MasterAxis=-1;
> ch1->LimitSwitchOptions=0x0;
> ch1->InputGain0=1;
> ch1->InputGain1=1;
> ch1->InputOffset0=0;
> ch1->InputOffset1=0;
> ch1->OutputGain=1;
> ch1->OutputOffset=0;
> ch1->SlaveGain=1;
> ch1->BacklashMode=BACKLASH_OFF;
> ch1->BacklashAmount=0;
> ch1->BacklashRate=0;
> ch1->invDistPerCycle=1;
> ch1->Lead=0;
> ch1->MaxFollowingError=1000000000;
> ch1->StepperAmplitude=20;
>
> ch1->iir[0].B0=1;
> ch1->iir[0].B1=0;
> ch1->iir[0].B2=0;
> ch1->iir[0].A1=0;
> ch1->iir[0].A2=0;
>
> ch1->iir[1].B0=1;
> ch1->iir[1].B1=0;
> ch1->iir[1].B2=0;
> ch1->iir[1].A1=0;
> ch1->iir[1].A2=0;
>
> ch1->iir[2].B0=1;
> ch1->iir[2].B1=0;
> ch1->iir[2].B2=0;
> ch1->iir[2].A1=0;
> ch1->iir[2].A2=0;
> EnableAxisDest(1,0);
>
> ch2->InputMode=NO_INPUT_MODE;
> ch2->OutputMode=STEP_DIR_MODE;
> ch2->Vel=80000;
> ch2->Accel=80000;
> ch2->Jerk=4e+006;
> ch2->P=0;
> ch2->I=0.01;
> ch2->D=0;
> ch2->FFAccel=0;
> ch2->FFVel=0;
> ch2->MaxI=200;
> ch2->MaxErr=1e+006;
> ch2->MaxOutput=200;
> ch2->DeadBandGain=1;
> ch2->DeadBandRange=0;
> ch2->InputChan0=0;
> ch2->InputChan1=0;
> ch2->OutputChan0=10;
> ch2->OutputChan1=0;
> ch2->MasterAxis=-1;
> ch2->LimitSwitchOptions=0x0;
> ch2->InputGain0=1;
> ch2->InputGain1=1;
> ch2->InputOffset0=0;
> ch2->InputOffset1=0;
> ch2->OutputGain=-1;
> ch2->OutputOffset=0;
> ch2->SlaveGain=1;
> ch2->BacklashMode=BACKLASH_OFF;
> ch2->BacklashAmount=0;
> ch2->BacklashRate=0;
> ch2->invDistPerCycle=1;
> ch2->Lead=0;
> ch2->MaxFollowingError=1000000000;
> ch2->StepperAmplitude=20;
>
> ch2->iir[0].B0=1;
> ch2->iir[0].B1=0;
> ch2->iir[0].B2=0;
> ch2->iir[0].A1=0;
> ch2->iir[0].A2=0;
>
> ch2->iir[1].B0=1;
> ch2->iir[1].B1=0;
> ch2->iir[1].B2=0;
> ch2->iir[1].A1=0;
> ch2->iir[1].A2=0;
>
> ch2->iir[2].B0=1;
> ch2->iir[2].B1=0;
> ch2->iir[2].B2=0;
> ch2->iir[2].A1=0;
> ch2->iir[2].A2=0;
> EnableAxisDest(2,0);
>
>
> ch3->InputMode=NO_INPUT_MODE;
> ch3->OutputMode=STEP_DIR_MODE;
> ch3->Vel=80000;
> ch3->Accel=80000;
> ch3->Jerk=4e+006;
> ch3->P=0;
> ch3->I=0.01;
> ch3->D=0;
> ch3->FFAccel=0;
> ch3->FFVel=0;
> ch3->MaxI=200;
> ch3->MaxErr=1e+006;
> ch3->MaxOutput=200;
> ch3->DeadBandGain=1;
> ch3->DeadBandRange=0;
> ch3->InputChan0=0;
> ch3->InputChan1=0;
> ch3->OutputChan0=11;
> ch3->OutputChan1=0;
> ch3->MasterAxis=-1;
> ch3->LimitSwitchOptions=0x0;
> ch3->InputGain0=1;
> ch3->InputGain1=1;
> ch3->InputOffset0=0;
> ch3->InputOffset1=0;
> ch3->OutputGain=-1;
> ch3->OutputOffset=0;
> ch3->SlaveGain=1;
> ch3->BacklashMode=BACKLASH_OFF;
> ch3->BacklashAmount=0;
> ch3->BacklashRate=0;
> ch3->invDistPerCycle=1;
> ch3->Lead=0;
> ch3->MaxFollowingError=1000000000;
> ch3->StepperAmplitude=20;
>
> ch3->iir[0].B0=1;
> ch3->iir[0].B1=0;
> ch3->iir[0].B2=0;
> ch3->iir[0].A1=0;
> ch3->iir[0].A2=0;
>
> ch3->iir[1].B0=1;
> ch3->iir[1].B1=0;
> ch3->iir[1].B2=0;
> ch3->iir[1].A1=0;
> ch3->iir[1].A2=0;
>
> ch3->iir[2].B0=1;
> ch3->iir[2].B1=0;
> ch3->iir[2].B2=0;
> ch3->iir[2].A1=0;
> ch3->iir[2].A2=0;
> EnableAxisDest(3,0);
>
>
>
> ch4->InputMode=NO_INPUT_MODE;
> ch4->OutputMode=STEP_DIR_MODE;
> ch4->Vel=80000;
> ch4->Accel=80000;
> ch4->Jerk=4e+006;
> ch4->P=0;
> ch4->I=0.01;
> ch4->D=0;
> ch4->FFAccel=0;
> ch4->FFVel=0;
> ch4->MaxI=200;
> ch4->MaxErr=1e+006;
> ch4->MaxOutput=200;
> ch4->DeadBandGain=1;
> ch4->DeadBandRange=0;
> ch4->InputChan0=0;
> ch4->InputChan1=0;
> ch4->OutputChan0=14;
> ch4->OutputChan1=0;
> ch4->MasterAxis=-1;
> ch4->LimitSwitchOptions=0x0;
> ch4->InputGain0=1;
> ch4->InputGain1=1;
> ch4->InputOffset0=0;
> ch4->InputOffset1=0;
> ch4->OutputGain=-1;
> ch4->OutputOffset=0;
> ch4->SlaveGain=1;
> ch4->BacklashMode=BACKLASH_OFF;
> ch4->BacklashAmount=0;
> ch4->BacklashRate=0;
> ch4->invDistPerCycle=1;
> ch4->Lead=0;
> ch4->MaxFollowingError=1000000000;
> ch4->StepperAmplitude=20;
>
> ch4->iir[0].B0=1;
> ch4->iir[0].B1=0;
> ch4->iir[0].B2=0;
> ch4->iir[0].A1=0;
> ch4->iir[0].A2=0;
>
> ch4->iir[1].B0=1;
> ch4->iir[1].B1=0;
> ch4->iir[1].B2=0;
> ch4->iir[1].A1=0;
> ch4->iir[1].A2=0;
>
> ch4->iir[2].B0=1;
> ch4->iir[2].B1=0;
> ch4->iir[2].B2=0;
> ch4->iir[2].A1=0;
> ch4->iir[2].A2=0;
> EnableAxisDest(4,0);
>
>
>
> ch5->InputMode=NO_INPUT_MODE;
> ch5->OutputMode=STEP_DIR_MODE;
> ch5->Vel=80000;
> ch5->Accel=80000;
> ch5->Jerk=4e+006;
> ch5->P=0;
> ch5->I=0.01;
> ch5->D=0;
> ch5->FFAccel=0;
> ch5->FFVel=0;
> ch5->MaxI=200;
> ch5->MaxErr=1e+006;
> ch5->MaxOutput=200;
> ch5->DeadBandGain=1;
> ch5->DeadBandRange=0;
> ch5->InputChan0=0;
> ch5->InputChan1=0;
> ch5->OutputChan0=15;
> ch5->OutputChan1=0;
> ch5->MasterAxis=-1;
> ch5->LimitSwitchOptions=0x0;
> ch5->InputGain0=1;
> ch5->InputGain1=1;
> ch5->InputOffset0=0;
> ch5->InputOffset1=0;
> ch5->OutputGain=-1;
> ch5->OutputOffset=0;
> ch5->SlaveGain=1;
> ch5->BacklashMode=BACKLASH_OFF;
> ch5->BacklashAmount=0;
> ch5->BacklashRate=0;
> ch5->invDistPerCycle=1;
> ch5->Lead=0;
> ch5->MaxFollowingError=1000000000;
> ch5->StepperAmplitude=20;
>
> ch5->iir[0].B0=1;
> ch5->iir[0].B1=0;
> ch5->iir[0].B2=0;
> ch5->iir[0].A1=0;
> ch5->iir[0].A2=0;
>
> ch5->iir[1].B0=1;
> ch5->iir[1].B1=0;
> ch5->iir[1].B2=0;
> ch5->iir[1].A1=0;
> ch5->iir[1].A2=0;
>
> ch5->iir[2].B0=1;
> ch5->iir[2].B1=0;
> ch5->iir[2].B2=0;
> ch5->iir[2].A1=0;
> ch5->iir[2].A2=0;
> EnableAxisDest(5,0);
>
>
> DefineCoordSystem6(0,1,2,3,4,5);
>
> SetBitDirection(45,1); // set Enable Signal as Output
> SetBit(45); // Enable the amplifiers
>
>
>
> return 0;
> }
>
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>> Hi Stephen,
>> Â
>> That would indicate some sort of invalid motion command or motion parameter. Please provide more information on how things are configured and what steps you are doing to cause this.
>> Â
>> Are you seeing this on the Axis Screen? Cycle power on KFLOP to set everything to the default configuration. Then observe that the Axis Screen shows 0 for the Destination. Then observe what step causes it to become invalid.
>> Â
>> Regards
>> TK
>>
>> From: stephen_lamarr <stephen_lamarr@...>
>> To: DynoMotion@yahoogroups.com
>> Sent: Wednesday, August 29, 2012 12:25 PM
>> Subject: [DynoMotion] KMotion Help
>>
>>
>> Â
>> I am getting a 1.#QNAN on my destination reading on my axis. Using stepper motors. I was told to post here for a resolution. I checked all of my accels; decels, velocity's, ect. all looks good. Not sure where to go from here. Any info would help.
>>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
Group: DynoMotion Message: 5626 From: Lee Studley Date: 8/29/2012
Subject: Re: KMotion Help
No, I don't think I'm correct there. sorry

On 8/29/2012 2:22 PM, Lee Studley wrote:
> Tau not defined:
>
> int main()
> {
> double T0, LastX=0, LastY=0, LastZ=0, Tau;
>
>
>
>
>
> On 8/29/2012 12:59 PM, stephen_lamarr wrote:
>> When I open up the axis screen all read 0. The NAN shows when I try to move the axis via my machine manager program. You may now of Machine Manager. Designed by Brad Murry. When machine manager is started up, the program loads the motion parameters. I am able to clear the destination out to 0 by disabeling and enabeling the motor. When I try and run the Home C program it fails on the first of six axis and gives me the NAN on the destination.
>>
>> This is the home c program.
>>
>> #include "KMotionDef.h"
>>
>> // Homing program for a 3 axis System
>> // Limit switches are disabled and used as a home switch
>> // then they are re-enabled
>>
>> #define XHOME 168
>> #define YHOME 169
>> #define ZHOME 170
>> void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset);
>>
>> main()
>> {
>>
>> DoHome( 0, // axis Laser #4
>> 100, // speed steps/sec
>> 1, // direction to home
>> 171, // home input bit
>> 1, // bit polarity (0 or 1) when tripped
>> 10); // amount to move back inside (counts)
>>
>> DoHome( 1, // Laser #3
>> 100, // speed steps/sec
>> -1, // direction to home
>> 170, // home input bit
>> 1, // bit polarity (0 or 1) when tripped
>> 10); // amount to move back inside (counts)
>>
>> DoHome( 2, // Laser #2
>> 100, // speed steps/sec
>> -1, // direction to home
>> 169, // home input bit
>> 1, // bit polarity (0 or 1) when tripped
>> 10); // amount to move back inside (counts)
>>
>> DoHome( 3, // Laser #1
>> 100, // speed steps/sec
>> 1, // direction to home
>> 168, // home input bit
>> 1, // bit polarity (0 or 1) when tripped
>> 10); // amount to move back inside (counts)
>>
>> DoHome( 4, // Laser #6
>> 100, // speed steps/sec
>> -1, // direction to home
>> 173, // home input bit
>> 1, // bit polarity (0 or 1) when tripped
>> 10); // amount to move back inside (counts)
>>
>> DoHome( 5, // Laser #5
>> 100, // speed steps/sec
>> 1, // direction to home
>> 172, // home input bit
>> 1, // bit polarity (0 or 1) when tripped
>> 10); // amount to move back inside (counts)
>>
>>
>> }
>> void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset)
>> {
>> float oppdir = dir * -1;
>>
>> EnableAxis(axis);
>> if(ReadBit(bit)==polarity)
>> {
>> Jog(axis, speed * oppdir); // start moving
>> while (ReadBit(bit) == polarity) ; // wait for switch (input #8) to change
>> Jog(axis,0); // stop
>> MoveRelAtVel(axis,sensoroffset * oppdir,speed);
>> }
>> Jog(axis, speed * dir); // start moving
>> while (ReadBit(bit) != polarity) ; // wait for switch (input #8) to change
>> Jog(axis,0); // stop
>> while (!CheckDone(axis)) ;
>> MoveRelAtVel(axis,sensoroffset * oppdir,speed);
>> while (!CheckDone(axis)) ;
>> EnableAxisDest(axis,0);
>> }
>>
>>
>> This is the c program that loads the paramaters on startup.
>>
>> #include "KMotionDef.h"
>>
>> // Defines axis 0, 1, 2 as simple step dir TTL outputs for KSTEP
>> // enables them
>> // sets them as an xyz coordinate system for GCode
>>
>> int main()
>> {
>> double T0, LastX=0, LastY=0, LastZ=0, Tau;
>>
>> KStepPresent=TRUE; // enable KSTEP input multiplexing
>> //FPGA(STEP_PULSE_LENGTH_ADD) = 0x80 + 32; // set inverted and to 2us
>> FPGA(STEP_PULSE_LENGTH_ADD) = 0x80 + 63;
>> ch0->InputMode=NO_INPUT_MODE;
>> ch0->OutputMode=STEP_DIR_MODE;
>> ch0->Vel=80000;
>> ch0->Accel=80000;
>> ch0->Jerk=4e+006;
>> ch0->P=0;
>> ch0->I=0.01;
>> ch0->D=0;
>> ch0->FFAccel=0;
>> ch0->FFVel=0;
>> ch0->MaxI=200;
>> ch0->MaxErr=1e+006;
>> ch0->MaxOutput=200;
>> ch0->DeadBandGain=1;
>> ch0->DeadBandRange=0;
>> ch0->InputChan0=0;
>> ch0->InputChan1=0;
>> ch0->OutputChan0=8;
>> ch0->OutputChan1=0;
>> ch0->MasterAxis=-1;
>> ch0->LimitSwitchOptions=0x0;
>> ch0->InputGain0=1;
>> ch0->InputGain1=1;
>> ch0->InputOffset0=0;
>> ch0->InputOffset1=0;
>> ch0->OutputGain=1;
>> ch0->OutputOffset=0;
>> ch0->SlaveGain=1;
>> ch0->BacklashMode=BACKLASH_OFF;
>> ch0->BacklashAmount=0;
>> ch0->BacklashRate=0;
>> ch0->invDistPerCycle=1;
>> ch0->Lead=0;
>> ch0->MaxFollowingError=1000000000;
>> ch0->StepperAmplitude=20;
>>
>> ch0->iir[0].B0=1;
>> ch0->iir[0].B1=0;
>> ch0->iir[0].B2=0;
>> ch0->iir[0].A1=0;
>> ch0->iir[0].A2=0;
>>
>> ch0->iir[1].B0=1;
>> ch0->iir[1].B1=0;
>> ch0->iir[1].B2=0;
>> ch0->iir[1].A1=0;
>> ch0->iir[1].A2=0;
>>
>> ch0->iir[2].B0=0.000769;
>> ch0->iir[2].B1=0.001538;
>> ch0->iir[2].B2=0.000769;
>> ch0->iir[2].A1=1.92076;
>> ch0->iir[2].A2=-0.923833;
>> EnableAxisDest(0,0);
>>
>> ch1->InputMode=NO_INPUT_MODE;
>> ch1->OutputMode=STEP_DIR_MODE;
>> ch1->Vel=80000;
>> ch1->Accel=80000;
>> ch1->Jerk=4e+006;
>> ch1->P=0;
>> ch1->I=0.01;
>> ch1->D=0;
>> ch1->FFAccel=0;
>> ch1->FFVel=0;
>> ch1->MaxI=200;
>> ch1->MaxErr=1e+006;
>> ch1->MaxOutput=200;
>> ch1->DeadBandGain=1;
>> ch1->DeadBandRange=0;
>> ch1->InputChan0=0;
>> ch1->InputChan1=0;
>> ch1->OutputChan0=13;//9;
>> ch1->OutputChan1=0;
>> ch1->MasterAxis=-1;
>> ch1->LimitSwitchOptions=0x0;
>> ch1->InputGain0=1;
>> ch1->InputGain1=1;
>> ch1->InputOffset0=0;
>> ch1->InputOffset1=0;
>> ch1->OutputGain=1;
>> ch1->OutputOffset=0;
>> ch1->SlaveGain=1;
>> ch1->BacklashMode=BACKLASH_OFF;
>> ch1->BacklashAmount=0;
>> ch1->BacklashRate=0;
>> ch1->invDistPerCycle=1;
>> ch1->Lead=0;
>> ch1->MaxFollowingError=1000000000;
>> ch1->StepperAmplitude=20;
>>
>> ch1->iir[0].B0=1;
>> ch1->iir[0].B1=0;
>> ch1->iir[0].B2=0;
>> ch1->iir[0].A1=0;
>> ch1->iir[0].A2=0;
>>
>> ch1->iir[1].B0=1;
>> ch1->iir[1].B1=0;
>> ch1->iir[1].B2=0;
>> ch1->iir[1].A1=0;
>> ch1->iir[1].A2=0;
>>
>> ch1->iir[2].B0=1;
>> ch1->iir[2].B1=0;
>> ch1->iir[2].B2=0;
>> ch1->iir[2].A1=0;
>> ch1->iir[2].A2=0;
>> EnableAxisDest(1,0);
>>
>> ch2->InputMode=NO_INPUT_MODE;
>> ch2->OutputMode=STEP_DIR_MODE;
>> ch2->Vel=80000;
>> ch2->Accel=80000;
>> ch2->Jerk=4e+006;
>> ch2->P=0;
>> ch2->I=0.01;
>> ch2->D=0;
>> ch2->FFAccel=0;
>> ch2->FFVel=0;
>> ch2->MaxI=200;
>> ch2->MaxErr=1e+006;
>> ch2->MaxOutput=200;
>> ch2->DeadBandGain=1;
>> ch2->DeadBandRange=0;
>> ch2->InputChan0=0;
>> ch2->InputChan1=0;
>> ch2->OutputChan0=10;
>> ch2->OutputChan1=0;
>> ch2->MasterAxis=-1;
>> ch2->LimitSwitchOptions=0x0;
>> ch2->InputGain0=1;
>> ch2->InputGain1=1;
>> ch2->InputOffset0=0;
>> ch2->InputOffset1=0;
>> ch2->OutputGain=-1;
>> ch2->OutputOffset=0;
>> ch2->SlaveGain=1;
>> ch2->BacklashMode=BACKLASH_OFF;
>> ch2->BacklashAmount=0;
>> ch2->BacklashRate=0;
>> ch2->invDistPerCycle=1;
>> ch2->Lead=0;
>> ch2->MaxFollowingError=1000000000;
>> ch2->StepperAmplitude=20;
>>
>> ch2->iir[0].B0=1;
>> ch2->iir[0].B1=0;
>> ch2->iir[0].B2=0;
>> ch2->iir[0].A1=0;
>> ch2->iir[0].A2=0;
>>
>> ch2->iir[1].B0=1;
>> ch2->iir[1].B1=0;
>> ch2->iir[1].B2=0;
>> ch2->iir[1].A1=0;
>> ch2->iir[1].A2=0;
>>
>> ch2->iir[2].B0=1;
>> ch2->iir[2].B1=0;
>> ch2->iir[2].B2=0;
>> ch2->iir[2].A1=0;
>> ch2->iir[2].A2=0;
>> EnableAxisDest(2,0);
>>
>>
>> ch3->InputMode=NO_INPUT_MODE;
>> ch3->OutputMode=STEP_DIR_MODE;
>> ch3->Vel=80000;
>> ch3->Accel=80000;
>> ch3->Jerk=4e+006;
>> ch3->P=0;
>> ch3->I=0.01;
>> ch3->D=0;
>> ch3->FFAccel=0;
>> ch3->FFVel=0;
>> ch3->MaxI=200;
>> ch3->MaxErr=1e+006;
>> ch3->MaxOutput=200;
>> ch3->DeadBandGain=1;
>> ch3->DeadBandRange=0;
>> ch3->InputChan0=0;
>> ch3->InputChan1=0;
>> ch3->OutputChan0=11;
>> ch3->OutputChan1=0;
>> ch3->MasterAxis=-1;
>> ch3->LimitSwitchOptions=0x0;
>> ch3->InputGain0=1;
>> ch3->InputGain1=1;
>> ch3->InputOffset0=0;
>> ch3->InputOffset1=0;
>> ch3->OutputGain=-1;
>> ch3->OutputOffset=0;
>> ch3->SlaveGain=1;
>> ch3->BacklashMode=BACKLASH_OFF;
>> ch3->BacklashAmount=0;
>> ch3->BacklashRate=0;
>> ch3->invDistPerCycle=1;
>> ch3->Lead=0;
>> ch3->MaxFollowingError=1000000000;
>> ch3->StepperAmplitude=20;
>>
>> ch3->iir[0].B0=1;
>> ch3->iir[0].B1=0;
>> ch3->iir[0].B2=0;
>> ch3->iir[0].A1=0;
>> ch3->iir[0].A2=0;
>>
>> ch3->iir[1].B0=1;
>> ch3->iir[1].B1=0;
>> ch3->iir[1].B2=0;
>> ch3->iir[1].A1=0;
>> ch3->iir[1].A2=0;
>>
>> ch3->iir[2].B0=1;
>> ch3->iir[2].B1=0;
>> ch3->iir[2].B2=0;
>> ch3->iir[2].A1=0;
>> ch3->iir[2].A2=0;
>> EnableAxisDest(3,0);
>>
>>
>>
>> ch4->InputMode=NO_INPUT_MODE;
>> ch4->OutputMode=STEP_DIR_MODE;
>> ch4->Vel=80000;
>> ch4->Accel=80000;
>> ch4->Jerk=4e+006;
>> ch4->P=0;
>> ch4->I=0.01;
>> ch4->D=0;
>> ch4->FFAccel=0;
>> ch4->FFVel=0;
>> ch4->MaxI=200;
>> ch4->MaxErr=1e+006;
>> ch4->MaxOutput=200;
>> ch4->DeadBandGain=1;
>> ch4->DeadBandRange=0;
>> ch4->InputChan0=0;
>> ch4->InputChan1=0;
>> ch4->OutputChan0=14;
>> ch4->OutputChan1=0;
>> ch4->MasterAxis=-1;
>> ch4->LimitSwitchOptions=0x0;
>> ch4->InputGain0=1;
>> ch4->InputGain1=1;
>> ch4->InputOffset0=0;
>> ch4->InputOffset1=0;
>> ch4->OutputGain=-1;
>> ch4->OutputOffset=0;
>> ch4->SlaveGain=1;
>> ch4->BacklashMode=BACKLASH_OFF;
>> ch4->BacklashAmount=0;
>> ch4->BacklashRate=0;
>> ch4->invDistPerCycle=1;
>> ch4->Lead=0;
>> ch4->MaxFollowingError=1000000000;
>> ch4->StepperAmplitude=20;
>>
>> ch4->iir[0].B0=1;
>> ch4->iir[0].B1=0;
>> ch4->iir[0].B2=0;
>> ch4->iir[0].A1=0;
>> ch4->iir[0].A2=0;
>>
>> ch4->iir[1].B0=1;
>> ch4->iir[1].B1=0;
>> ch4->iir[1].B2=0;
>> ch4->iir[1].A1=0;
>> ch4->iir[1].A2=0;
>>
>> ch4->iir[2].B0=1;
>> ch4->iir[2].B1=0;
>> ch4->iir[2].B2=0;
>> ch4->iir[2].A1=0;
>> ch4->iir[2].A2=0;
>> EnableAxisDest(4,0);
>>
>>
>>
>> ch5->InputMode=NO_INPUT_MODE;
>> ch5->OutputMode=STEP_DIR_MODE;
>> ch5->Vel=80000;
>> ch5->Accel=80000;
>> ch5->Jerk=4e+006;
>> ch5->P=0;
>> ch5->I=0.01;
>> ch5->D=0;
>> ch5->FFAccel=0;
>> ch5->FFVel=0;
>> ch5->MaxI=200;
>> ch5->MaxErr=1e+006;
>> ch5->MaxOutput=200;
>> ch5->DeadBandGain=1;
>> ch5->DeadBandRange=0;
>> ch5->InputChan0=0;
>> ch5->InputChan1=0;
>> ch5->OutputChan0=15;
>> ch5->OutputChan1=0;
>> ch5->MasterAxis=-1;
>> ch5->LimitSwitchOptions=0x0;
>> ch5->InputGain0=1;
>> ch5->InputGain1=1;
>> ch5->InputOffset0=0;
>> ch5->InputOffset1=0;
>> ch5->OutputGain=-1;
>> ch5->OutputOffset=0;
>> ch5->SlaveGain=1;
>> ch5->BacklashMode=BACKLASH_OFF;
>> ch5->BacklashAmount=0;
>> ch5->BacklashRate=0;
>> ch5->invDistPerCycle=1;
>> ch5->Lead=0;
>> ch5->MaxFollowingError=1000000000;
>> ch5->StepperAmplitude=20;
>>
>> ch5->iir[0].B0=1;
>> ch5->iir[0].B1=0;
>> ch5->iir[0].B2=0;
>> ch5->iir[0].A1=0;
>> ch5->iir[0].A2=0;
>>
>> ch5->iir[1].B0=1;
>> ch5->iir[1].B1=0;
>> ch5->iir[1].B2=0;
>> ch5->iir[1].A1=0;
>> ch5->iir[1].A2=0;
>>
>> ch5->iir[2].B0=1;
>> ch5->iir[2].B1=0;
>> ch5->iir[2].B2=0;
>> ch5->iir[2].A1=0;
>> ch5->iir[2].A2=0;
>> EnableAxisDest(5,0);
>>
>>
>> DefineCoordSystem6(0,1,2,3,4,5);
>>
>> SetBitDirection(45,1); // set Enable Signal as Output
>> SetBit(45); // Enable the amplifiers
>>
>>
>>
>> return 0;
>> }
>>
>>
>> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>>> Hi Stephen,
>>> Â
>>> That would indicate some sort of invalid motion command or motion parameter. Please provide more information on how things are configured and what steps you are doing to cause this.
>>> Â
>>> Are you seeing this on the Axis Screen? Cycle power on KFLOP to set everything to the default configuration. Then observe that the Axis Screen shows 0 for the Destination. Then observe what step causes it to become invalid.
>>> Â
>>> Regards
>>> TK
>>>
>>> From: stephen_lamarr <stephen_lamarr@...>
>>> To: DynoMotion@yahoogroups.com
>>> Sent: Wednesday, August 29, 2012 12:25 PM
>>> Subject: [DynoMotion] KMotion Help
>>>
>>>
>>> Â
>>> I am getting a 1.#QNAN on my destination reading on my axis. Using stepper motors. I was told to post here for a resolution. I checked all of my accels; decels, velocity's, ect. all looks good. Not sure where to go from here. Any info would help.
>>>
>>
>> ------------------------------------
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
Group: DynoMotion Message: 5627 From: brad murry Date: 8/29/2012
Subject: Re: KMotion Help
What happens when you leave MM out of the equation?

Power cycle the kflop, start Kmotion, run unit file and then try homing.  If you get errors, we know it is a bad c file setting, otherwise it will be a configuration issue with MM.  Also, make sure to use latest Kmotion.dll's

-Brad Murry

From: stephen_lamarr
Sent: 8/29/2012 12:59 PM
To: DynoMotion@yahoogroups.com
Subject: [DynoMotion] Re: KMotion Help

 

When I open up the axis screen all read 0. The NAN shows when I try to move the axis via my machine manager program. You may now of Machine Manager. Designed by Brad Murry. When machine manager is started up, the program loads the motion parameters. I am able to clear the destination out to 0 by disabeling and enabeling the motor. When I try and run the Home C program it fails on the first of six axis and gives me the NAN on the destination.

This is the home c program.

#include "KMotionDef.h"

// Homing program for a 3 axis System
// Limit switches are disabled and used as a home switch
// then they are re-enabled

#define XHOME 168
#define YHOME 169
#define ZHOME 170
void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset);

main()
{

DoHome( 0, // axis Laser #4
100, // speed steps/sec
1, // direction to home
171, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)

DoHome( 1, // Laser #3
100, // speed steps/sec
-1, // direction to home
170, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)

DoHome( 2, // Laser #2
100, // speed steps/sec
-1, // direction to home
169, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)

DoHome( 3, // Laser #1
100, // speed steps/sec
1, // direction to home
168, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)

DoHome( 4, // Laser #6
100, // speed steps/sec
-1, // direction to home
173, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)

DoHome( 5, // Laser #5
100, // speed steps/sec
1, // direction to home
172, // home input bit
1, // bit polarity (0 or 1) when tripped
10); // amount to move back inside (counts)


}
void DoHome(int axis, float speed, int dir, int bit, int polarity, float sensoroffset)
{
float oppdir = dir * -1;

EnableAxis(axis);
if(ReadBit(bit)==polarity)
{
Jog(axis, speed * oppdir); // start moving
while (ReadBit(bit) == polarity) ; // wait for switch (input #8) to change
Jog(axis,0); // stop
MoveRelAtVel(axis,sensoroffset * oppdir,speed);
}
Jog(axis, speed * dir); // start moving
while (ReadBit(bit) != polarity) ; // wait for switch (input #8) to change
Jog(axis,0); // stop
while (!CheckDone(axis)) ;
MoveRelAtVel(axis,sensoroffset * oppdir,speed);
while (!CheckDone(axis)) ;
EnableAxisDest(axis,0);
}

This is the c program that loads the paramaters on startup.

#include "KMotionDef.h"

// Defines axis 0, 1, 2 as simple step dir TTL outputs for KSTEP
// enables them
// sets them as an xyz coordinate system for GCode

int main()
{
double T0, LastX=0, LastY=0, LastZ=0, Tau;

KStepPresent=TRUE; // enable KSTEP input multiplexing
//FPGA(STEP_PULSE_LENGTH_ADD) = 0x80 + 32; // set inverted and to 2us
FPGA(STEP_PULSE_LENGTH_ADD) = 0x80 + 63;
ch0->InputMode=NO_INPUT_MODE;
ch0->OutputMode=STEP_DIR_MODE;
ch0->Vel=80000;
ch0->Accel=80000;
ch0->Jerk=4e+006;
ch0->P=0;
ch0->I=0.01;
ch0->D=0;
ch0->FFAccel=0;
ch0->FFVel=0;
ch0->MaxI=200;
ch0->MaxErr=1e+006;
ch0->MaxOutput=200;
ch0->DeadBandGain=1;
ch0->DeadBandRange=0;
ch0->InputChan0=0;
ch0->InputChan1=0;
ch0->OutputChan0=8;
ch0->OutputChan1=0;
ch0->MasterAxis=-1;
ch0->LimitSwitchOptions=0x0;
ch0->InputGain0=1;
ch0->InputGain1=1;
ch0->InputOffset0=0;
ch0->InputOffset1=0;
ch0->OutputGain=1;
ch0->OutputOffset=0;
ch0->SlaveGain=1;
ch0->BacklashMode=BACKLASH_OFF;
ch0->BacklashAmount=0;
ch0->BacklashRate=0;
ch0->invDistPerCycle=1;
ch0->Lead=0;
ch0->MaxFollowingError=1000000000;
ch0->StepperAmplitude=20;

ch0->iir[0].B0=1;
ch0->iir[0].B1=0;
ch0->iir[0].B2=0;
ch0->iir[0].A1=0;
ch0->iir[0].A2=0;

ch0->iir[1].B0=1;
ch0->iir[1].B1=0;
ch0->iir[1].B2=0;
ch0->iir[1].A1=0;
ch0->iir[1].A2=0;

ch0->iir[2].B0=0.000769;
ch0->iir[2].B1=0.001538;
ch0->iir[2].B2=0.000769;
ch0->iir[2].A1=1.92076;
ch0->iir[2].A2=-0.923833;
EnableAxisDest(0,0);

ch1->InputMode=NO_INPUT_MODE;
ch1->OutputMode=STEP_DIR_MODE;
ch1->Vel=80000;
ch1->Accel=80000;
ch1->Jerk=4e+006;
ch1->P=0;
ch1->I=0.01;
ch1->D=0;
ch1->FFAccel=0;
ch1->FFVel=0;
ch1->MaxI=200;
ch1->MaxErr=1e+006;
ch1->MaxOutput=200;
ch1->DeadBandGain=1;
ch1->DeadBandRange=0;
ch1->InputChan0=0;
ch1->InputChan1=0;
ch1->OutputChan0=13;//9;
ch1->OutputChan1=0;
ch1->MasterAxis=-1;
ch1->LimitSwitchOptions=0x0;
ch1->InputGain0=1;
ch1->InputGain1=1;
ch1->InputOffset0=0;
ch1->InputOffset1=0;
ch1->OutputGain=1;
ch1->OutputOffset=0;
ch1->SlaveGain=1;
ch1->BacklashMode=BACKLASH_OFF;
ch1->BacklashAmount=0;
ch1->BacklashRate=0;
ch1->invDistPerCycle=1;
ch1->Lead=0;
ch1->MaxFollowingError=1000000000;
ch1->StepperAmplitude=20;

ch1->iir[0].B0=1;
ch1->iir[0].B1=0;
ch1->iir[0].B2=0;
ch1->iir[0].A1=0;
ch1->iir[0].A2=0;

ch1->iir[1].B0=1;
ch1->iir[1].B1=0;
ch1->iir[1].B2=0;
ch1->iir[1].A1=0;
ch1->iir[1].A2=0;

ch1->iir[2].B0=1;
ch1->iir[2].B1=0;
ch1->iir[2].B2=0;
ch1->iir[2].A1=0;
ch1->iir[2].A2=0;
EnableAxisDest(1,0);

ch2->InputMode=NO_INPUT_MODE;
ch2->OutputMode=STEP_DIR_MODE;
ch2->Vel=80000;
ch2->Accel=80000;
ch2->Jerk=4e+006;
ch2->P=0;
ch2->I=0.01;
ch2->D=0;
ch2->FFAccel=0;
ch2->FFVel=0;
ch2->MaxI=200;
ch2->MaxErr=1e+006;
ch2->MaxOutput=200;
ch2->DeadBandGain=1;
ch2->DeadBandRange=0;
ch2->InputChan0=0;
ch2->InputChan1=0;
ch2->OutputChan0=10;
ch2->OutputChan1=0;
ch2->MasterAxis=-1;
ch2->LimitSwitchOptions=0x0;
ch2->InputGain0=1;
ch2->InputGain1=1;
ch2->InputOffset0=0;
ch2->InputOffset1=0;
ch2->OutputGain=-1;
ch2->OutputOffset=0;
ch2->SlaveGain=1;
ch2->BacklashMode=BACKLASH_OFF;
ch2->BacklashAmount=0;
ch2->BacklashRate=0;
ch2->invDistPerCycle=1;
ch2->Lead=0;
ch2->MaxFollowingError=1000000000;
ch2->StepperAmplitude=20;

ch2->iir[0].B0=1;
ch2->iir[0].B1=0;
ch2->iir[0].B2=0;
ch2->iir[0].A1=0;
ch2->iir[0].A2=0;

ch2->iir[1].B0=1;
ch2->iir[1].B1=0;
ch2->iir[1].B2=0;
ch2->iir[1].A1=0;
ch2->iir[1].A2=0;

ch2->iir[2].B0=1;
ch2->iir[2].B1=0;
ch2->iir[2].B2=0;
ch2->iir[2].A1=0;
ch2->iir[2].A2=0;
EnableAxisDest(2,0);

ch3->InputMode=NO_INPUT_MODE;
ch3->OutputMode=STEP_DIR_MODE;
ch3->Vel=80000;
ch3->Accel=80000;
ch3->Jerk=4e+006;
ch3->P=0;
ch3->I=0.01;
ch3->D=0;
ch3->FFAccel=0;
ch3->FFVel=0;
ch3->MaxI=200;
ch3->MaxErr=1e+006;
ch3->MaxOutput=200;
ch3->DeadBandGain=1;
ch3->DeadBandRange=0;
ch3->InputChan0=0;
ch3->InputChan1=0;
ch3->OutputChan0=11;
ch3->OutputChan1=0;
ch3->MasterAxis=-1;
ch3->LimitSwitchOptions=0x0;
ch3->InputGain0=1;
ch3->InputGain1=1;
ch3->InputOffset0=0;
ch3->InputOffset1=0;
ch3->OutputGain=-1;
ch3->OutputOffset=0;
ch3->SlaveGain=1;
ch3->BacklashMode=BACKLASH_OFF;
ch3->BacklashAmount=0;
ch3->BacklashRate=0;
ch3->invDistPerCycle=1;
ch3->Lead=0;
ch3->MaxFollowingError=1000000000;
ch3->StepperAmplitude=20;

ch3->iir[0].B0=1;
ch3->iir[0].B1=0;
ch3->iir[0].B2=0;
ch3->iir[0].A1=0;
ch3->iir[0].A2=0;

ch3->iir[1].B0=1;
ch3->iir[1].B1=0;
ch3->iir[1].B2=0;
ch3->iir[1].A1=0;
ch3->iir[1].A2=0;

ch3->iir[2].B0=1;
ch3->iir[2].B1=0;
ch3->iir[2].B2=0;
ch3->iir[2].A1=0;
ch3->iir[2].A2=0;
EnableAxisDest(3,0);



ch4->InputMode=NO_INPUT_MODE;
ch4->OutputMode=STEP_DIR_MODE;
ch4->Vel=80000;
ch4->Accel=80000;
ch4->Jerk=4e+006;
ch4->P=0;
ch4->I=0.01;
ch4->D=0;
ch4->FFAccel=0;
ch4->FFVel=0;
ch4->MaxI=200;
ch4->MaxErr=1e+006;
ch4->MaxOutput=200;
ch4->DeadBandGain=1;
ch4->DeadBandRange=0;
ch4->InputChan0=0;
ch4->InputChan1=0;
ch4->OutputChan0=14;
ch4->OutputChan1=0;
ch4->MasterAxis=-1;
ch4->LimitSwitchOptions=0x0;
ch4->InputGain0=1;
ch4->InputGain1=1;
ch4->InputOffset0=0;
ch4->InputOffset1=0;
ch4->OutputGain=-1;
ch4->OutputOffset=0;
ch4->SlaveGain=1;
ch4->BacklashMode=BACKLASH_OFF;
ch4->BacklashAmount=0;
ch4->BacklashRate=0;
ch4->invDistPerCycle=1;
ch4->Lead=0;
ch4->MaxFollowingError=1000000000;
ch4->StepperAmplitude=20;

ch4->iir[0].B0=1;
ch4->iir[0].B1=0;
ch4->iir[0].B2=0;
ch4->iir[0].A1=0;
ch4->iir[0].A2=0;

ch4->iir[1].B0=1;
ch4->iir[1].B1=0;
ch4->iir[1].B2=0;
ch4->iir[1].A1=0;
ch4->iir[1].A2=0;

ch4->iir[2].B0=1;
ch4->iir[2].B1=0;
ch4->iir[2].B2=0;
ch4->iir[2].A1=0;
ch4->iir[2].A2=0;
EnableAxisDest(4,0);



ch5->InputMode=NO_INPUT_MODE;
ch5->OutputMode=STEP_DIR_MODE;
ch5->Vel=80000;
ch5->Accel=80000;
ch5->Jerk=4e+006;
ch5->P=0;
ch5->I=0.01;
ch5->D=0;
ch5->FFAccel=0;
ch5->FFVel=0;
ch5->MaxI=200;
ch5->MaxErr=1e+006;
ch5->MaxOutput=200;
ch5->DeadBandGain=1;
ch5->DeadBandRange=0;
ch5->InputChan0=0;
ch5->InputChan1=0;
ch5->OutputChan0=15;
ch5->OutputChan1=0;
ch5->MasterAxis=-1;
ch5->LimitSwitchOptions=0x0;
ch5->InputGain0=1;
ch5->InputGain1=1;
ch5->InputOffset0=0;
ch5->InputOffset1=0;
ch5->OutputGain=-1;
ch5->OutputOffset=0;
ch5->SlaveGain=1;
ch5->BacklashMode=BACKLASH_OFF;
ch5->BacklashAmount=0;
ch5->BacklashRate=0;
ch5->invDistPerCycle=1;
ch5->Lead=0;
ch5->MaxFollowingError=1000000000;
ch5->StepperAmplitude=20;

ch5->iir[0].B0=1;
ch5->iir[0].B1=0;
ch5->iir[0].B2=0;
ch5->iir[0].A1=0;
ch5->iir[0].A2=0;

ch5->iir[1].B0=1;
ch5->iir[1].B1=0;
ch5->iir[1].B2=0;
ch5->iir[1].A1=0;
ch5->iir[1].A2=0;

ch5->iir[2].B0=1;
ch5->iir[2].B1=0;
ch5->iir[2].B2=0;
ch5->iir[2].A1=0;
ch5->iir[2].A2=0;
EnableAxisDest(5,0);


DefineCoordSystem6(0,1,2,3,4,5);

SetBitDirection(45,1); // set Enable Signal as Output
SetBit(45); // Enable the amplifiers


return 0;
}

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Stephen,
>  
> That would indicate some sort of invalid motion command or motion parameter.  Please provide more information on how things are configured and what steps you are doing to cause this.
>  
> Are you seeing this on the Axis Screen?  Cycle power on KFLOP to set everything to the default configuration.  Then observe that the Axis Screen shows 0 for the Destination.  Then observe what step causes it to become invalid.
>  
> Regards
> TK
>
> From: stephen_lamarr <stephen_lamarr@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, August 29, 2012 12:25 PM
> Subject: [DynoMotion] KMotion Help
>
>
>  
> I am getting a 1.#QNAN on my destination reading on my axis. Using stepper motors. I was told to post here for a resolution. I checked all of my accels; decels, velocity's, ect. all looks good. Not sure where to go from here. Any info would help.
>

Group: DynoMotion Message: 5628 From: Tom Kerekes Date: 8/29/2012
Subject: Re: KMotion Help
Hi Stephan,
 
Please do as Brad suggests as I don't see anything wrong with the programs and they work ok for me.
 
If the C programs are Compiled/Linked using a different DSPKFLOP.out file than what is flashed in KFLOP then memory addresses will be incorrect and unpredictable results.
 
The location of the KMotionDLL.dll is used to find the DSPKFLOP.out file to be used (they are within the same directory)
 
Regards
TK